/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 combat_header_table.h

	$Header: /heroes4/combat_header_table.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( COMBAT_HEADER_TABLE_H_INCLUDED )
#define COMBAT_HEADER_TABLE_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <string>
#include <vector>
#include <utility>

#include "combat_obstacle_data.h"
#include "format_string.h"


// -------------------------------------------------------------------------------
// t_combat_header_table class - a header table for combat objects
// -------------------------------------------------------------------------------
class t_combat_header_table
{
public:
	// Types
	typedef t_int32				t_size_type;


	// Constructors / Destructor
	t_combat_header_table();
	~t_combat_header_table();

	// Member functions	
	void						fill_obstacle_array(t_obstacle_data_array & array) const;
	void						get_date_string(std::string & date) const;
	void						insert( std::string const& name , t_combat_object_model_base const& model_data );
	bool						read( std::streambuf& buffer);
	void						read_string(std::streambuf& buffer , std::string & string_in );
	void						set_date(t_int32 month , t_int32 day, t_int32 year, t_int32 hour, t_int32 minute );
	t_size_type					size() const;
	bool						write( std::streambuf& buffer ) const;
	void						write_string( std::streambuf& buffer , std::string const& string_out ) const;
	
private:

	// Data members
	t_obstacle_data_array		m_table;
	
	t_int32						m_day;
	t_int32						m_month;
	t_int32						m_year;
	t_int32						m_hour;
	t_int32						m_minute;
};

inline bool read( std::streambuf& buffer, t_combat_header_table& combat_header_table )
{
	return combat_header_table.read( buffer );
}

// ------------------------------------------------------------------
// combat header consts
// ------------------------------------------------------------------

extern const std::string k_combat_header_table_name;

extern const std::string k_combat_header_table_resource_name;

// ------------------------------------------------------------------------------
// t_resource_traits< t_combat_header_table >
// ------------------------------------------------------------------------------

template <>
struct t_resource_traits< t_combat_header_table >
{
	static char const prefix[];
	static char const extension[];
};

#endif // COMBAT_HEADER_TABLE_H_INCLUDED